#include	<stdio.h>
#include	<string.h>
#include	<stdlib.h>
#include	<stdbool.h>
#include	<unistd.h>
#include	<assert.h>
#include	<signal.h>
#include	<fcntl.h>
#include	<netinet/in.h>
#include	<arpa/inet.h>
#include	<sys/ioctl.h>
#include	<sys/time.h>
#include	<sys/types.h>
#include	<sys/socket.h>

#include	<event.h>
#include	<evutil.h>

#include	"types.h"
#include	"a_parameters.h"
#include	"performance.h"
#include	"TCPconnections.h"
#include	"multicast_connections.h"
#include	"acceptor.h"
#include	"learner.h"
#include	"multicaster.h"
#include	"coordinator.h"
#include	"UDP.h"
#include	"macros.h"
#include	"config_parser.h"
#include	"str_parser.h"

struct sockaddr_in ring_successor_addr, ring_self_addr, *ipmAddr;
struct timeval startTime, endTime, end, start, performance_start_time, performance_end_time, tv1, tv2;
struct event *print_stat_timeout_eve, *multicast_timeout_eve, *proposer_get_value_eve, *recv_ring_sock_eve, *recv_multicast_sock_eve;

paxos_data *paxos_instances;
paxos_msg *pm;
inst *new_data, *data;

int SUBMIT_PER_WAKE;
int lowestDelivered, gapEnd;
bool MULTICASTER, rtag, COORDINATOR;
//struct event *learners_sockEvent;
//-----------------------OTHERS----------------------------
extern paxos_msg *accept_msg;
extern struct timeval last, current, spent;
extern double latency[1500000];
